<template>
	<view class="content">
		<view class="item" style="background-color: #b6b6b6;color: #FFFFFF;" >
			<button style="height: 150rpx;line-height: 125rpx;" @click="scanCode" > 扫一扫</button>
		</view>
		
		<view class="item" v-for="(item, index) in historylist" :key="index" >
			<view class="demo-layout" >{{item.prizeName}}</view>
			<view style="height: 10px;"></view>
			<u-row gutter="16" >
				<u-col  span="12" text-align="left">
					<view class="demo-layout" >领取地址：{{item.prizeAddress}}</view>
				</u-col>
				<u-col  span="6" text-align="left">
					<view class="demo-layout ">未分配数量：{{item.noneAmount}}</view>
				</u-col>
				<u-col  span="6" text-align="left">
					<view class="demo-layout ">待领取数量：{{item.waitAmount}}</view>
				</u-col>
				<view style="height: 40px;"></view>
				<u-col  span="6" text-align="left">
					<view class="demo-layout ">提供数量：{{item.prizeAmount}}</view>
				</u-col>
				<u-col  span="6" text-align="left">
					<view class="demo-layout ">剩余数量：{{item.restAmount}}</view>
				</u-col>
			</u-row>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				historylist: [{}],
				merchantId:''
			}
		},
		onLoad() {
/* 				this.$u.api.selectMerchantPrizeInfo()({
					studentId:
				}).then(res => {
					this.historylist=res.rows;
					console.log(this.historylist);
				}) */
		},
		onLoad: function(option) {
			console.log(option.merchantId)
			this.$u.api.selectMerchantPrizeInfo({
				merchantId: option.merchantId
			}).then(res => {
				this.historylist=res.rows
				console.log(this.historylist)
			})
		},
		methods: {
			navigate(path,caseId,caseStatus){
				uni.navigateTo({
				    url: path+'?caseId=' +caseId +'&caseStatus=' + caseStatus
				});
			},
			scanCode() {
				// 只允许通过相机扫码
				var that = this;
				uni.scanCode({
					onlyFromCamera: true,
					success: function(res) {
						console.log('条码内容：' + res.result);
						that.$u.api.updatePrizeType({
							QRcodeInfo: res.result
						}).then(respon => {
							console.log(respon)
						})
					}
				});
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		font-size: 31upx;
	}
	.item {
		margin-top: 20upx;
		border-bottom:1upx solid #000000 ;
		padding: 20upx;
	}
	.demo-layout{
		
	}
	.flex{
		display:flex;
		align-items:center
	}
	.mt{
		margin-top:10upx;
	}


</style>
